<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>06_列表渲染</title>
</head>
<body>

<!--
1. 列表显示
  数组: v-for / index
  对象: v-for / key
2. 列表的更新显示
  删除item
  替换item
-->

<div id="demo">
  <h2>测试: v-for 遍历数组</h2>
  <ul>
    <li v-for="(person,index) in persons" :key="index">
      {{person.id}}--{{person.name}}--{{person.age}}
    </li>
  </ul>

  <h2>测试: v-for 遍历对象</h2>
 <ul>
   <li v-for="(val,key) in persons[0]" :key="key">
     {{key}}--{{val}}
   </li>
 </ul>
</div>

<script type="text/javascript" src="../js/vue.js"></script>
<script type="text/javascript">
new Vue({
  el:"#demo",
  data:{
    persons:
    [
    {id:1,name:"jack",age:12},
    {id:2,name:"rose",age:12},
    {id:3,name:"tom",age:12},
    ]
  }
})
</script>
</body>
</html>